/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view.ihm;

import mod.dao.tables;
import java.awt.Graphics;
import java.sql.ResultSet;
import javax.swing.JPanel;
import ctrl.sys.ClientReceive;
import ctrl.sys.clientTCP;
import ctrl.jeu.Table;

/**
 *
 * @author willy
 */
public class panJeu extends JPanel{
    Table t;
    clientTCP clientReseau;
    /** Creates new form Test */
    public panJeu(String ser, int idTable) {
        clientReseau=new clientTCP();
        clientReseau.Connexion(ser);

        setLayout(null);
        // lecture des tables en bd et création des instances
        tables tabledao=new tables();
        ResultSet r=tabledao.Liste(idTable);
        try {
            if (r.next())
            {
                t=(new Table(r.getInt("id"),r.getInt("blind"),r.getInt("min"),r.getInt("max")));
                //break;
            }
        }catch(Exception e)
        {

        }
        new ClientReceive(clientReseau.getClient(),t).start();
        repaint();

    }


    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);

        t.Affiche(this,120,100);
        validate();
    }

    public static void main(String[] args)
    {
        Load t=null;
        if(args.length>0)
        {
            //t=new Load(args[0],1);
        }
        else
        {
            //t=new Load(config.serveurSocket,1);
        }
        t.setVisible(true);
        //t.repaint();

    }
}
